import { Controller, Post, Get, Body } from '@nestjs/common'
import { UsersService } from '../users/users.service'

@Controller()
export class UsersController {
  constructor(private usersService: UsersService) {}

  @Post('/insertUser')
  async insertUser(@Body() data: any) {
    return this.usersService.insertMany([data])
  }

  @Get('/findUsers')
  async findUsers() {
    return this.usersService.find()
  }

  @Post('/updateUser')
  async updateUser(@Body() data: any) {
    return this.usersService.updateOne(data)
  }

  @Post('/deleteUser')
  async deleteUser(@Body() data: any) {
    return this.usersService.deleteOne(data)
  }
}
